Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

feat(frontend): display detailed balance information on AccountDetails page #447

Merged
merged 19 commits into from
Oct 20, 2020

Conversation

icerove
Copy link
Contributor

@icerove icerove commented Oct 8, 2020

fix #291
Total Balance = Account balance + Lockup balance (wallet is + unlockup balance, but frol said it is wrong)
Available Balance = Account Balance - Minimum Balance
Minimum Balance = Bytes used * cost per byte
Lockup Balance = get_lockup_balance (wallet usage)
Staked Balance = Current “Locked Balance”

@render
Copy link

render bot commented Oct 8, 2020

@icerove icerove marked this pull request as ready for review October 8, 2020 18:42
@icerove icerove requested a review from frol as a code owner October 8, 2020 18:42
@icerove
Copy link
Contributor Author

icerove commented Oct 8, 2020

491f774 commit is current version which uses RPC and our database to get lockup balance and timestamp, which is workable. But I also tried to use viewLockupState function in the https://github.com/near/account-lookup/blob/master/script.js which is really weird. I want to show up here to to get some help.

@icerove
Copy link
Contributor Author

icerove commented Oct 8, 2020

I find out it is the issue for account-lookup not from mine. That one cannot be used since I think our function to decode uint8array is weird .

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

backend/src/wamp.js Outdated Show resolved Hide resolved
@icerove icerove requested a review from frol October 13, 2020 20:08
@frol frol changed the title simple build need fix feat(frontend): display detailed balance information on AccountDetails page Oct 14, 2020
icerove and others added 2 commits October 15, 2020 11:07
@icerove icerove requested a review from frol October 15, 2020 22:34
@frol
Copy link
Collaborator

frol commented Oct 16, 2020

@icerove I have moved the logic to the backend since fetching the genesis config and doing a view call to the lockup contract needs to be done through it anyway (instead of using near-api-js on the client; we should not use RPC from the client side since we may end up providing inconsistent data from the backend and the direct RPC calls from the browser, so it is better to use backend to do all the calls to NEAR RPC). The changes are half-backed, please, finish them up (mostly on the frontend side, I believe).

availableBalance: "43454321345678765432345678",
totalBalance: "9876545678765432134567876543",
storageUsage: "876",
lockupTotalBalance: "765654565324543",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a test for an account without lockup account information

</Row>
{account.lockupTotalBalance && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that we will miss the total balance information if there is no information about the lockup balance. This should not be the case

@@ -18,36 +19,55 @@ export interface Props {
export default class extends React.Component<Props> {
render() {
const { account } = this.props;
console.log(account);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the log

@frol frol merged commit 71652aa into master Oct 20, 2020
@frol frol deleted the feature/lockup-balance branch October 20, 2020 16:09
chefsale added a commit that referenced this pull request Oct 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display locked token balance breakdown on Account Detail page
2 participants